//
//  GQJStarView.m
//  TotalDemo
//
//  Created by gujian on 16/7/7.
//  Copyright © 2016年 gujian. All rights reserved.
//

#import "GQJStarView.h"

#define PSIZE 16

@implementation GQJStarView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
    }
    
    return self;
}

- (void)drawRect:(CGRect)rect {
    // Drawing code
    
    CGSize size = self.frame.size;
    int k;
    double r, theta;
    
    r = 0.8 * size.width / 2.0;
    theta = 2 * M_PI * (2.0/5.0);  //144degrees
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextTranslateCTM(context, size.width/2.0, size.height/2.0);
    
    [[UIColor yellowColor] set];
    CGContextSetLineWidth(context, 1.0);
    
    CGContextMoveToPoint(context, 0, r);
    
    for (k = 1; k < 5; k++) {
        CGContextAddLineToPoint(context, r * sin(k * theta), r * cos(k * theta));
    }
    
    
    CGContextClosePath(context);
    
    [[UIColor redColor] set];
    
   
    CGContextFillPath(context);
    
    
}
























@end
